A lens fixed to the middle of the screen, and the sprite slides through it: full size in the middle, narrower and shorter toward the top and bottom of the lens, gone at its edge - like a picture on a drum that is rolling past you. Move the sprite up or down and it rolls. depth is how tight the lens is: 1 is as tall as the screen, 6 is tight.
Works differently on Game Boy - The Game Boy narrows the picture on some lines by moving its two sprite pieces toward each other (the middle is covered, not squeezed), a drum or a band hides it outside the lens; 16 pixels wide at most, one picture at a time; the size is not used.
Works differently on Game Boy Color - The Game Boy Color narrows the picture on some lines by moving its two sprite pieces toward each other (the middle is covered, not squeezed), a drum or a band hides it outside the lens; 16 pixels wide at most, one picture at a time; the size is not used.
Sega Genesis: not built yet
On other consoles this differs: see Side by side and How the consoles differ.
SPRITE_DRUM: constantNames the drum, a shape for draw_sprite_3d and draw_sprite_3d_scaled. The other three shapes put the curve on the picture, and it goes wherever the sprite goes. The drum puts it on the screen: there is a lens in the middle of the picture, and sprites slide through it. A sprite whose middle is in the middle row is full size and flat. As it slides up or down it gets narrower and shorter, and at the edge of the lens it closes up to nothing, like a picture on a drum that is rolling past you. It is the sprite's own name for TEXT_DRUM, and works the same way.


The same call every frame, with only y changing: the lighthouse rolls down through the lens. Nine real pictures from a Game Boy Advance ROM, played in a loop. A tall striped lighthouse stands in for the example's spr_doc_tower. A viewer that does not play it shows only the first frame.
So the thing you animate is the sprite's own y. Draw it low and move it up and it rises out of the floor, growing as it comes. Park its middle on the middle row (row 80 of the 160 pixel screen) and it stands there looking completely ordinary. Push it on and it dwindles away over the top. That is what makes it good for a boss that arrives, a logo that rolls in, or a picture that recedes into the distance as a scene begins.


Six frames of the roll, with the row the sprite's middle is on written under each (row 80 is the middle of the screen).
A row of the picture that is far from the middle of the screen is drawn smaller than one near the middle, and the size falls off as the square of the distance, so it is nearly full size for a good way either side of the middle and then drops away quickly toward the edge. The numbers are made for you.
For the drum, depth goes from 1 to 6, not 1 to 3 like the other sprite shapes. It is not a curve on the picture at all: it sets how tall the lens is, in rows above and below the middle of the screen, so it does not matter what the picture is.
| depth | the lens reaches | what it is like |
|---|---|---|
| 1 | 100 rows each way | taller than the screen: a sprite is only squashed a little near the top and the bottom |
| 2 | 84 rows | |
| 3 | 72 rows | a sprite is clearly smaller by the time it is half way to the edge |
| 4 | 62 rows | |
| 5 | 54 rows | |
| 6 | 46 rows | a tight lens: a sprite is full size only close to the middle and has closed up well before the edge of the screen |


The same sprite, held in one place 20 rows below the middle, at each depth. The sprite has not moved: the lens has.
A number below 1 draws the plain, flat sprite and costs nothing, and a number above 6 is read as 6.
draw_sprite_3d puts a sprite in the room, so work out where it lands on the screen first (the room's y minus the camera's).draw_sprite_3d. The lens is worked out in memory the first time it is used, so it adds nothing to the size of the game.draw_sprite_3d(spr_doc_tower, x, y, 0, SPRITE_DRUM, 3);The tower in a lens of depth 3. Where it is on the screen decides how big it is: change y and it rolls.
draw_sprite_3d(spr_doc_tower, x, y + wave(-60, 60, 180, 0), 0, SPRITE_DRUM, 3);A tower that rolls up and down over and over (one trip up and back every three seconds), shrinking as it goes toward either edge of the lens.